package java6681.group;

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;


/**
 * @author Junichiro vb
 * @description 测试类
 * @date 2021-03-29 23:04
 **/

public class TaskGroupsDemo6681 {
    public static void main(String[] args) throws FileNotFoundException {
        TaskGroups6681 taskGroups6681 = new TaskGroups6681();
        TaskGroups6681 taskGroups = new TaskGroups6681();
        ArrayList<Student6681> stuList;
        // 加载学生信息
        try {
            stuList = taskGroups.initStudents();
        } catch (FileNotFoundException e) {
            System.out.println("找不到学生信息文件...");
            return;
        }
        System.out.println("班级人数: " + stuList.size());
        //获取分组方案
        ArrayList<Integer> groupCase = taskGroups.getGroupCase(stuList.size());
        // 根据分组方案, 创建分组集合
        ArrayList<Student6681[]> groupList = taskGroups.getGroupList(groupCase, stuList);

        System.out.println("经过1次循环, 得到分组方案: 分为" + groupCase.size() + "组 : " + groupCase.toString());
        for (int i = 0; i < groupList.size(); i++) {
            System.out.println("第" + (i + 1) + "组: " + Arrays.toString(groupList.get(i)) + groupList.get(i).length + "人");
        }
    }
}


